﻿using System.ComponentModel;
namespace GeneticAlgorithms
{
    /// <summary>
    /// Provides configuration info for a Genetic Algorithm
    /// </summary>    
    public interface IGAConfiguration
    {
        /// <summary>
        /// Gets or sets the desired fitness to be attained.
        /// </summary>
        /// <value>The desired fitness to be attained.</value>
        /// <remarks>
        /// If this property is set, the GA will stop when at least
        /// one genome has reached the desired fitness.
        /// </remarks>
        [Category("Stop conditions")]
        double? DesiredFitness { get; set; }

        /// <summary>
        /// Gets or sets the maxValue number generations to evolve.
        /// </summary>
        /// <value>The max number of generations generations allow.</value>
        /// <remarks>
        /// If this property is set, the GA will stop when 
        /// this number of generations has been reached.
        /// </remarks>
        [Category("Stop conditions")]
        int? MaxGenerations { get; set; }

        /// <summary>
        /// Gets or sets the max milliseconds.
        /// </summary>
        /// <value>The max milliseconds.</value>
        /// <remarks>
        /// If this property is set, the GA will stop after the
        /// given amount of milliseconds has elapsed.
        /// </remarks>
        [Category("Stop conditions")]
        long? MaxMilliseconds { get; set; }

        /// <summary>
        /// Gets or sets the min generation variance.
        /// </summary>
        /// <value>The min generation variance.</value>
        /// <remarks>
        /// If this property is set, the GA will stop when the
        /// generational variance has fallen before this threshold.
        /// </remarks>
        [Category("Stop conditions")]
        double? MinGenerationVariance { get; set; }


        /// <summary>
        /// Gets or sets a value indicating whether the GA should
        /// calculate variance at each generation.
        /// </summary>
        /// <value>
        /// If set to <c>true</c>, the GA will calculate variance
        /// at each evolutional step.
        /// </value>
        /// <remarks>
        /// Since variance calculation can have a performance impact,
        /// this option is off by default.
        /// </remarks>
        [Category("Calculations")]
        bool CalculateVariance { get; set; }
    }
}
